const state = {
  stationList: [], // 站点列表,
  selectedStation: {}// 当前选中的站点
}

const getters = {
  stationList: state => state.stationList,
  selectedStation: state => state.selectedStation
}

const actions = {
  fetchStationList: ({ commit, state }, text) => {
    commit('updateStationList', text)
  },
  fetchSelectedStation: ({commit, state}, text) => {
    commit('updateSelectedStation', text)
  }
}

const mutations = {
  updateStationList: (state, payload) => {
    state.stationList = payload
  },
  updateSelectedStation: (state, payload) => {
    state.selectedStation = payload
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
